package Core::Fields;

use strict;
use warnings;
use vars qw{ @ISA @EXPORT };
use Exporter;
use Core::MetaMap;
use Core::Field;

@ISA = qw( Core::MetaMap );
@EXPORT = qw (
   Fields
);

sub Fields
#*****************************************************************************
# PURPOSE:
# USAGE: 
# PASSED ARGS:
# RETURN ARGS:
# $sError - Fail Error Message
#*****************************************************************************
{ 
	my $rhGList = Core::Fields->new( @_ );
	return $rhGList;	
}	

sub add
#*****************************************************************************
# PURPOSE:
# USAGE: 
# PASSED ARGS:
# RETURN ARGS:
# $sError - Fail Error Message
#*****************************************************************************
{ 
	my( $rhSelf ) = shift;
	my( $rhMeta );
	foreach my $sName ( @_ ){
		# New meta found
		if ( not $rhSelf->exist( $sName ) ){
			$rhMeta = Field( $sName ); # Create Meta obj	
			# Only push the meta not in the metalist
			push @{ $rhSelf->{ LIST } }, $rhMeta;
			$rhSelf->__calIndex();	
		}
	}
	return 1;
}

sub toFieldNameList
#*****************************************************************************
# PURPOSE:
# USAGE: 
# PASSED ARGS:
# RETURN ARGS:
# $sError - Fail Error Message
#*****************************************************************************
{ 
	my( $rhSelf ) = shift;
	return $rhSelf->toOrgNameList();
}	

sub toString
#*****************************************************************************
# PURPOSE:
# USAGE: 
# PASSED ARGS:
# RETURN ARGS:
# $sError - Fail Error Message
#*****************************************************************************
{
	my( $rhSelf ) = shift;
	my $sValue = "Fields ( " . $rhSelf->size()  . " )\n";
	$sValue .= "[ " . join( ", ", $rhSelf->toFieldNameList() ) . " ]\n";
	return $sValue;
}



1
__END__;